package net.lab1024.sa.admin.module.device.terminal.domain;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import net.lab1024.sa.admin.module.device.terminal.constant.RemoteUrlConstant;

import java.time.LocalDateTime;

@Data
public class DeviceTerminalVO {

    @Schema(description = "主键自增id")
    private Long id;

    @Schema(description = "设备序列号")
    private String serialno;

    @Schema(description = "上游id")
    private String upstreamId;

    @Schema(description = "上游标识")
    private Integer upstreamCode;

    @Schema(description = "系统类型")
    private String osType;

    @Schema(description = "心跳时间")
    private LocalDateTime heartbeatTime;

    @Schema(description = "连接状态")
    private Boolean linkFlag;

    @Schema(description = "命令执行状态")
    private Integer executeStatus;

    @Schema(description = "执行结果内容")
    private String executeResult;

    @Schema(description = "请求状态")
    private Integer requestStatus;

    @Schema(description = "请求失败描述信息")
    private String requestFailDesc;

    @Schema(description = "远程终端地址")
    private String remoteUrl;

    @Schema(description = "ip")
    private String ip;

    @Schema(description = "国家")
    private String country;

    @Schema(description = "省份")
    private String province;

    @Schema(description = "城市")
    private String city;

    @Schema(description = "县区")
    private String county;

    @Schema(description = "运营商")
    private String isp;

    @Schema(description = "删除状态")
    private Boolean deletedFlag;

    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    public void setSerialno(String serialno) {
        this.serialno = serialno;
        this.remoteUrl = StrUtil.format(RemoteUrlConstant.REMOTE_TERMINAL_URL, serialno);
    }
}
